package qz_rpt

class RepairByMonthController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }
    def repairByMonth(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        params.SYS_QUERY_NAME = 'repairByMonth'
        def repairByMonth = dynamicQueryService.queryForList(params)
        def tableHeadList =  []
        if(repairByMonth.size()>0){
            tableHeadList =  repairByMonth[0].keySet()
        }
        params.SYS_QUERY_NAME = 'repairByMonthCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        params.SYS_QUERY_NAME = 'repairByMonthUser'
        def repairByMonthUser = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'repairByMonthRepairNo'
        def repairByMonthRepairNo = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'repairByMonthStepDesc'
        def repairByMonthStepDesc = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'repairByMonthSaveCodeList'
        def repairByMonthSaveCodeList = dynamicQueryService.queryForList(params)
        [totalCount:totalCount,tableHeadList:tableHeadList,
         pageSizeList:pageSizeList,pageSize:pageSize,repairByMonth:repairByMonth,
         startno:params.startno?:'',endno:params.endno?:'',user:params.user?:'',step:params.step?:'',
         startTime:params.startTime?:'',endTime:params.endTime?:'',repairByMonthUser:repairByMonthUser,group4:params.group4?:'',
         repairByMonthUser:repairByMonthUser,repairByMonthStepDesc:repairByMonthStepDesc,repairByMonthSaveCodeList:repairByMonthSaveCodeList,
         repairByMonthRepairNo:repairByMonthRepairNo,repairNo:params.repairNo?:'']

    }
}
